import vv from '../../Common/vv';
// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class LgRankItem extends cc.Component {

   
    //排名
    @property(cc.Label)
    rank:cc.Label = null
    
    //头像
    @property(cc.Node)
    icon:cc.Node = null
    
    //姓名
    @property(cc.Label)
    nameStr:cc.Label = null

    //分数
    @property(cc.Label)
    score:cc.Label = null

    //排名图片
   @property(cc.Node)
   rankicon:cc.Node = null

    // onLoad () {}

    start () {

    }

    setData(ItemData)
    {
      
       if(ItemData.rank == '1')
       {
           let url = 'texture/paihang/one'
            vv.SetImageByLocalUrl(url,this.rankicon) 
       }
       if(ItemData.rank == '2')
       {
           let url = 'texture/paihang/two'
            vv.SetImageByLocalUrl(url,this.rankicon) 
       }
       if(ItemData.rank == '3')
       {
           let url = 'texture/paihang/three'
            vv.SetImageByLocalUrl(url,this.rankicon) 
       }
       else
       {
             this.rank.string = ItemData.rank
       }
       vv.SetWeChatImageByWebUrl(ItemData.avatar,this.icon)
      // vv.SetImageByLocalUrl(ItemData.avatar,this.icon)
       this.nameStr.string = ItemData.nickname
       this.score.string = ItemData.credit3
    }

    // update (dt) {}
}
